/**
 * ...
 * @author Franco Ponticelli
 */

package uform.ui.comp;
import uform.property.Property;
import uform.ui.comp.Control;
import uform.ui.comp.Component;

class BoolControl extends Control<Bool>
{
	public var displayValues(default, null) : Property<String>;
	public var displayTrue(getDisplayTrue, null) : String;
	public var displayFalse(getDisplayFalse, null) : String;
	
	public function new(name : String, ?value : Bool, displayTrue = "true", displayFalse = "false")
	{
		super(name, value);
		displayValues = new Property(displayTrue + ";" + displayFalse);
	}
	
	public function swap()
	{
		value.set(!(true == value.get()));
	}
	
	function getDisplayTrue()
	{
		return displayValues.get().split(";").shift();
	}
	
	function getDisplayFalse()
	{
		return displayValues.get().split(";").pop();
	}
}